import request from '../utils/request'

export const getUsers = () => {
  return request({
    method: 'get',
    url: '/users'
  })
}

export const getUsersById = (id) => {
  return request({
    method: 'get',
    url: '/users/' + id
  })
}

export const addUsers = (data) => {
  return request({
    method: 'post',
    url: '/users',
    data
  })
}

export const editUsers = (data, id) => {
  // 更新接口使用 put 或者 patch
  return request({
    method: 'patch',
    url: '/users/' + id,
    data
  })
}

export const deleteUsers = (id) => {
  return request({
    method: 'delete',
    url: '/users/' + id
  })
}
